import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/styles/index.scss'

Vue.use(ElementUI)

Vue.config.productionTip = false

Vue.prototype.$imgUrl = 'http://localhost:5010'
Vue.prototype.$dateBtn = (dateNew) => {
  // 假设从 MongoDB 获取的时间对象
  const utcDate = new Date(dateNew);
  // 转换为北京时间
  const beijingOptions = {
    year: 'numeric',
    month: '2-digit',
    day: '2-digit',
    hour: '2-digit',
    minute: '2-digit',
    second: '2-digit',
    hour12: false,
    timeZone: 'Asia/Shanghai'
  };
  const beijingTime = utcDate.toLocaleString('zh-CN', beijingOptions);
  return beijingTime;
}

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
